import { GCellRenderer } from "../../../../../../com/mui/controls/GCellRenderer";
import { GlobalClass } from "../../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../../resource/ImagesConst";
import { GTextFormat } from "../../../../../common/GTextFormat";
import { FontUtil } from "../../../../../common/font/FontUtil";
import { GlobalStyle } from "../../../../../common/global/GlobalStyle";
import { ObjCreate } from "../../../common/ObjCreate";
import { GRCThreeRankData } from "./GRCThreeRankData";
import { HTMLUtil } from "../../../../../../com/gengine/utils/HTMLUtil";
import { EntityUtil } from "../../../../scene/layer/utils/EntityUtil";
import { Cache } from "../../../../cache/Cache";
import { GTextFiled } from "../../../../../../com/mui/controls/GTextFiled";
//class GRCThreeRankHurtRenderer
    
    export  class GRCThreeRankHurtRenderer extends GCellRenderer
    {
        constructor()
        {
            super();
            var loc1=null;
            this._adoreImg = GlobalClass.getBitmap(ImagesConst.RangeAdore);
            this._adoreImg.x = 10;
            this._adoreImg.y = 6;
            this.addChild(this._adoreImg);
            loc1 = new GTextFormat(FontUtil.songtiName, 12, GlobalStyle.color1Uint);
            this._rank = ObjCreate.createGTextField("", 30, 5, 150, 20, this, loc1);
            this._rank.mouseEnabled = false;
            this._guildName = ObjCreate.createGTextField("", 100, 5, 150, 20, this, loc1);
            this._guildName.mouseEnabled = false;
            this._name = ObjCreate.createGTextField("", 290, 5, 150, 20, this, loc1);
            this._name.mouseEnabled = false;
            this._hurt = ObjCreate.createGTextField("", 460, 5, 150, 20, this, loc1);
            this._hurt.mouseEnabled = false;
            this._hurtPer = ObjCreate.createGTextField("", 550, 5, 150, 20, this, loc1);
            this._hurtPer.mouseEnabled = false;
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            var loc2=null;
            super.data = arg1;
            var loc1=arg1 as GRCThreeRankData;
            if (loc1) 
            {
                if (loc1.rank > 0 && loc1.rank < 4) 
                {
                    this._adoreImg.visible = true;
                }
                else 
                {
                    this._adoreImg.visible = false;
                }
                loc2 = "";
                if (loc1.rank != 1) 
                {
                    if (loc1.rank != 2) 
                    {
                        if (loc1.rank != 3) 
                        {
                            loc2 = GlobalStyle.color1;
                        }
                        else 
                        {
                            loc2 = GlobalStyle.color4;
                        }
                    }
                    else 
                    {
                        loc2 = GlobalStyle.color8;
                    }
                }
                else 
                {
                    loc2 = GlobalStyle.color9;
                }
                this._rank.htmlText = HTMLUtil.addColor(loc1.rank + "", loc2);
                this._guildName.htmlText = HTMLUtil.addColor(loc1.guildName, GlobalStyle.color1);
                this._name.htmlText = HTMLUtil.addColor(loc1.name, GlobalStyle.color1);
                this._hurt.htmlText = HTMLUtil.addColor(loc1.hurt + "", GlobalStyle.color9);
                this._hurtPer.htmlText = HTMLUtil.addColor(loc1.hurtPersent, "#FFFF00");
                if (EntityUtil.equal(loc1.entityId, Cache.instance.role.entityInfo.entityId)) 
                {
                    this.graphics.clear();
                    this.graphics.beginFill(GlobalStyle.color5Uint, 0.4);
                    this.graphics.drawRoundRect(5, 0, 630, 30, 2, 2);
                    this.graphics.endFill();
                }
                else 
                {
                    this.graphics.clear();
                }
            }
            return;
        }

        /* internal */ /* var */_rank: GTextFiled;

        /* internal */ /* var */_guildName: GTextFiled;

        /* internal */ /* var */_name: GTextFiled;

        /* internal */ /* var */_hurt: GTextFiled;

        /* internal */ /* var */_hurtPer: GTextFiled;

        /* internal */ /* var */_adoreImg: Object /* flash.display.Bitmap */;
    }
